package Beans;

import BO.Service;
import ws.UserUI;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;


public class RegisterBean {

    private String name;
    private String password;
    private String email;
    
    /** Creates a new instance of RegisterBean */
    public RegisterBean() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    
    public String registerUser(){
        UserUI user = Service.registerUser(name, email, password);
        if(user != null){
            
            HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
            session.setAttribute("User", user);
            
            return "true";
        }
        else{
            return "false";
        }
        
        
    }
    
    
}
